package com.njtoyo.taxi.admin.library.taxi_service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Objects;

@Slf4j
@Service
public class SkillPrizedService {

    @Autowired
    private RestTemplate restTemplate;

    @Value("${config.taxiService.activityUrl}")
    private String baseUrl;

    public Boolean resetAward() {
        String url = baseUrl + "/campaign/general/reset/award";

        log.info("请求url {}", url);
        SkillPrizedResponse res = restTemplate.postForObject(url, null, SkillPrizedResponse.class);

        log.info("返回值: {}", res);

        return Objects.nonNull(res) && res.getCode() == 0;
    }
}
